<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <g:set var="entityName" value="${message(code: 'company.label', default: 'company')}" />
    <title>${this.company?.name}</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <div class="page-header">
                <div class="page-header-title">
                    <h4>${this.company?.name}</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                            <g:link controller="company" action="index">列表</g:link>
                        </li>
                        <li class="breadcrumb-item">${this.company?.name}</li>
                    </ul>
                </div>
            </div>

            <div class="page-body">
                <g:if test="${flash.message}">
                    <div class="message alert alert-info" role="status">${flash.message}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span></button>
                    </div>
                </g:if>

                <div class="card">
                    <div class="card-header">
                        <h5>公司详情</h5>

                        <div class="card-header-right">
                            <g:link action="edit" resource="${this.company}" id="${it?.contact?.id}" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                                <i class="icofont icofont-edit"></i>
                            </g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">序列号</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.serialNumber}</div>
                            </div>
                            <label class="col-md-2 col-form-label">名称</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.name}</div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">工商&机构代码</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.code}</div>
                            </div>
                            <label class="col-md-2 col-form-label">行业</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.industry?.name}</div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">最大客户数量</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.maximumNumberOfAccount}</div>
                            </div>
                            <label class="col-md-2 col-form-label">最大用户数量</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.maximumNumberOfUser}</div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>参数</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">开启客户区域管理</label>
                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.enableAccountTerritory}</div>
                            </div>

                            <label class="col-md-2 col-form-label">开启联系人区域管理</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.enableContactTerritory}</div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">继承客户区域</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.inheritanceAccountTerritory}</div>
                            </div>
                            <label class="col-md-2 col-form-label">开启商机区域管理</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.enableOpportunityTerritory}</div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">开启商机工作流</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.enableOpportunityWorkflow}</div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">文件服务器地址</label>

                            <div class="col-md-3">
                                <div class="form-control-static">${this.company?.fileServer}</div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>部门</h5>

                        <div class="card-header-right">
                            <g:link controller="department" action="create" params="[company: this.company?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="新增">
                                <i class="fa fa-plus"></i></g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block dt-responsive">

                        <div class="table-responsive">
                            <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <g:sortableColumn property="name" title="部门" />
                                            <g:sortableColumn property="active" title="是否启用" />
                                            <g:sortableColumn property="createdDate" title="创建时间" />
                                            <g:sortableColumn property="modifiedDate" title="修改时间" />
                                            <th width="10%" class="text-center">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <g:each in="${com.next.Department.findAllByCompany(this.company)}">
                                            <tr>
                                                <td>
                                                    <g:link action="show" controller="department" id="${it?.id}" class="firstTd">${it?.name}</g:link>
                                                </td>
                                                <td>${it?.active}</td>
                                                <td>
                                                    <g:formatDate date="${it?.createdDate}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                                </td>
                                                <td>
                                                    <g:formatDate date="${it?.modifiedDate}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                                </td>
                                                <td class="text-center">
                                                    <g:link class="m-r-15 text-primary" controller="department" action="edit" id="${it?.id}">
                                                        <i class="icofont icofont-ui-edit"></i>
                                                    </g:link>

                                                    <g:form controller="department" action="delete" style="display: inline-block" id="${it.id}" method="DELETE">
                                                        <button class="deleteBtn text-danger" type="button">
                                                            <i class="icofont icofont-trash"></i>
                                                        </button>
                                                    </g:form>
                                                </td>

                                            </tr>
                                        </g:each>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>

</body>

</html>
